#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
@version: ??
@author: happiness
@license: Apache Licence 
@contact: happiness_ws@163.com
@site: 
@software: PyCharm
@file: store.py
@time: 2017/11/6 16:24
"""

import tensorflow as tf

# 创建变量
# x = tf.Variable(tf.constant(1, shape=[1]))
# y = tf.Variable(tf.constant(2, shape=[1]))
#
# result = x + y
#
# init_op = tf.global_variables_initializer()



# saver = tf.train.Saver()

# with tf.Session() as sess:
#     sess.run(init_op)
#     saver.save(sess, "./model/model.ckpt")
#     sess.close()

saver = tf.train.import_meta_graph("./model/model.ckpt.meta")

with tf.Session() as sess:
    # sess.run(init_op)
    saver.restore(sess, "./model/model.ckpt")
    # sess.run(result)
    print(sess.run(tf.get_default_graph().get_tensor_by_name("add:0")))
    sess.close()
